<div class="main-view"><!--最外层div-->
    <br><div class="left-margin top-margin"><strong class="am-text-primary am-text-lg">帖子列表</strong></div>

    <form class="am-form-inline left-margin top-margin" role="form">

        <div class="city-cascading" style="display: inline-block;" id="cascad-search"></div>
        <button id="search-target" data-am-modal="{target: '#loading'}" type="submit" class="am-btn am-btn-primary left-margin" ng-click="search()" data-target="cascad-search">搜索</button>


        <div class="am-modal am-modal-loading am-modal-no-btn" id="loading">
            <div class="am-modal-dialog">
                <div class="am-modal-hd">正在载入...</div>
                <div class="am-modal-bd">
                    <span class="am-icon-spinner am-icon-spin"></span>
                </div>
            </div>
        </div>


        <div class="top-margin">

            <label class="left-margin">类别:</label>
            <select ng-model="category">
                <option value=''>全部</option>
                <option value='question'>问问</option>
                <option value='share'>说说</option>
            </select>
            <label class="left-margin">跨小区:</label>
            <select ng-model="aroundCommunity">
                <option value=''>全部</option>
                <option value=1>是</option>
                <option value=2>否</option>
            </select>
            <label class="left-margin">状态:</label>
            <select ng-model="status">
                <option value=''>全部</option>
                <option value=1>未解决</option>
                <option value=2>已解决</option>
                <option value=3>处理中</option>
            </select>
            <!--<label class="left-margin">标签:</label>-->
            <!--<select ng-model="tag">-->
                <!--<option value=''>全部</option>-->
                <!--<option value=true>有标签</option>-->
                <!--<option value=false>无标签</option>-->
            <!--</select>-->

            <label class="left-margin">回复:</label>
            <select ng-model="replies">
                <option value=''>全部</option>
                <option value=true>有</option>
                <option value=false>无</option>
            </select>

            <label class="left-margin">精华帖:</label>
            <select ng-model="level">
                <option value=''>全部</option>
                <option value=1>精华帖</option>
                <option value=0>非精华帖</option>
            </select>

            <label class="left-margin">排序方式:</label>
            <select ng-model="sort">
                <option value=''>发布</option>
                <option value=true">回复</option>
            </select>

            <label class="left-margin">城市分类:</label>
            <select ng-model="cityType">
                <option value=''>全部</option>
                <option value=-1>非北京上海</option>
            </select>
        </div>

        <div  class="top-margin">
            <label class="left-margin">发布时间:</label>
            <input type="text" id="startDate" class="modal-input" size="16" data-date-format="yyyy-mm-dd hh:ii">
            <label class="left-margin">至：</label>
            <input type="text" id="endDate" class="modal-input" size="16" data-date-format="yyyy-mm-dd hh:ii">


            <label class="left-margin">创建者:</label>
            <input type="text" class="form-control" placeholder="" style="margin-left:0px;width: 100px" ng-model="nickName">

            <label class="left-margin">创建者ID:</label>
            <input type="text" class="form-control" placeholder="" style="margin-left:0px;width: 150px" ng-model="createdBy">

            <label class="left-margin">关键字:</label>
            <input type="text" class="form-control" placeholder="" style="margin-left:0px;width: 150px" ng-model="desc">

        </div>

    </form>
    <br>

    <div class="am-btn-group am-btn-group-xs left-margin top-margin">
        <button type="button" class="am-btn am-btn-default" ng-click="exportQuestion()"><span class="am-icon-download"></span> 导出</button>
    </div>
    <div style="display:inline">
        <div id="pagination" class="pagination"></div>
        <!--<div>共<span id = 'page_number2'>{{pageNumber}}</span>页 <span>{{count}}条数据</span></div>-->
    </div>
    <div class="pagination-table left-margin" id="tab_menu" style = "margin-top: 0px;">
        <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
                <thead>
                <tr>
                    <th class="table-check"><input type="checkbox" ng-click="allSelected()"></th>
                    <th class="table-title">城市</th>
                    <th class="table-title">所属小区</th>
                    <!--<th class="table-title">板块内小区</th>-->
                    <!--<th class="table-title">标签</th>-->
                    <th class="table-title">浏览次数</th>
                    <th class="table-title">点赞次数	</th>
                    <th class="table-title">描述</th>
                    <th class="table-title">类型</th>
                    <th class="table-title">回复/数量</th>
                    <th class="table-title">创建者</th>
                    <th class="table-title">发布时间</th>
                    <th class="table-title">最后修改时间</th>
                    <th class="table-title">操作</th>

                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="question in questionList"  id = "{{question.objId}}">
                    <td class="table-check"><input type="checkbox" class = "item-check"></td>
                    <td>{{question.city.name}}</td>
                    <td>{{question.community.communityName}}</td>
                    <!--<td><div style = "display: table-cell;vertical-align: middle; width: 300px; height: 60px; overflow:auto;"><span ng-repeat="t in question.aroundCommunity">{{t}} </span></div></td>-->
                    <!--<td><span ng-repeat="t in question.tag">{{t}} </span></td>-->
                    <td>{{question.browserCount}}</td>
                    <td>{{question.praiseCount}}</td>
                    <td title="{{question.desc}}" style="width: 400px;word-wrap:break-word;"><div style = "position: relative;width: 400px; height: 60px; overflow:auto;line-height: 1.2;">{{question.desc}}</div></td>
                    <td>{{question.categoryName}}</td>

                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">

                            <a  data-am-modal="{target:'#doc-modal-reply-{{$index}}', width: 1200, height: 600}">查看</a>/{{question.replies.length}}

                            <div class="am-modal am-modal-no-btn" id="doc-modal-reply-{{$index}}">
                                <div class="modal-dialog">
                                    <div class="modal-content" style = "overflow-y: scroll;height: 600px;">

                                        <br><h2 class="left-margin" align="left">问题：{{question.desc}}</h2><br>

                                        <div class="modal-body">
                                            <slide ng-repeat="img in question.images" active="img.active">
                                                <img ng-src="{{img.imageURL}}" style="width: 180px;height: 180px;">
                                            </slide>
                                        </div>

                                        <div class="modal-body">
                                            <table class="table table-condensed">
                                                <thead>
                                                <tr>
                                                    <th>回复</th>
                                                    <th>回复者</th>
                                                    <th>小区</th>
                                                    <th align="right">回复时间</th>
                                                    <!-- 宝宝树66小区二次改造 后台管理追加删除评论 add wangcan 20170925 start -->
                                                    <th align="right">操作</th>
                                                    <!-- 宝宝树66小区二次改造 后台管理追加删除评论 add wangcan 20170925 end -->
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <tr ng-repeat="r in question.replies" data-rep-id={{r.repliedBy.objId}} data-rep-name={{r.repliedBy.nickName}} ng-click="getRepId($event, r.repliedBy)">

                                                    <td width="200" style = "white-space:normal; width:700px;">{{r.replyDesc}}</td>
                                                    <td width="100">{{r.repliedBy.nickName}}</td>
                                                    <!-- 宝宝树66小区二次改造 后台管理追加删除评论 add wangcan 20170926 start -->
                                                    <!--<td width="100">{{r.repliedBy.communityName}}</td>-->
                                                    <td width="100">{{question.community.communityName}}</td>
                                                    <!-- 宝宝树66小区二次改造 后台管理追加删除评论 add wangcan 20170926 end -->
                                                    <td width="150">{{r.dateReplied | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                                                    <!-- 宝宝树66小区二次改造 后台管理追加删除评论 add wangcan 20170925 start -->
                                                    <td width="100">
                                                        <button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger" ng-click="deleteQuestionReply(question, $index)"><span class="am-icon-trash-o"></span> 删除</button>
                                                    </td>
                                                    <!-- 宝宝树66小区二次改造 后台管理追加删除评论 add wangcan 20170925 end -->
                                                </tr>
                                                </tbody>
                                            </table>

                                            <form>
                                                <div style = "margin-bottom: 10px;">
                                                    <label style = "margin-right: 42px;" ng-click="repPost($event)"><input  type="radio" checked="true" name="repClass" value="post" class="rep-post radio-rep"> 回复帖子</label>
                                                    <label style = "margin-right: 6px;" ng-click="repPerson($event)"><input type="radio" name="repClass" value="person" class="rep-person radio-rep"> 回复某人</label>
                                                    <label><input readonly="ture" type="text" class = "select-person" placeholder="点击每行选择"></label>
                                                </div>



                                                <input type="text" class="form-control" placeholder="回复内容..."  ng-model="data.replyDesc" id="reply">

                                            </form>
                                        </div>


                                        <div class = "button-area border-top">
                                            <button type="button" class="am-btn am-btn-success right-margin top-margin"  ng-click="sendReply(question, data.replyDesc,$index)" data-community-id = {{question.community.objId}}>回复</button>
                                        </div>

                                    </div>
                                </div>
                            </div>


                            </div>
                        </div>
                    </td>


                    <td><div>{{question.createdBy.nickName}}</div></td>
                    <td><div>{{question.dateCreated | date:'yyyy-MM-dd'}}<br>{{question.dateCreated | date:'HH:mm:ss'}}</div></td>
                    <td><div>{{question.dateLastModified | date:'yyyy-MM-dd'}}<br>{{question.dateLastModified | date:'HH:mm:ss'}}</div></td>

                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">

                                <!--<button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>-->
                                <!--<button class="am-btn am-btn-default "><span class="am-icon-copy"></span> 复制</button>-->
                                <!--<button class="am-btn am-btn-default am-btn-xs am-text-danger"><span class="am-icon-trash-o"></span> 删除</button>-->

                                <!--<button data-am-popover="{content: '想显示啥', trigger: 'click', theme: 'warning lg'}" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 测试</button>-->

                                <button data-am-modal="{target:'#doc-modal-Detail-{{$index}}', width: 800, height: 400}" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
                                <button data-am-modal="{target:'#delete-confirm-{{$index}}'}" class="am-btn am-btn-default am-btn-xs am-text-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                <button data-am-modal="{target:'#shield-confirm-{{$index}}'}"  ng-hide="(question.isShow==-1)" class="am-btn am-btn-default am-btn-xs am-text-danger"><span class="am-icon-trash-o"></span> 屏蔽</button>
                                <button ng-click="shieldQuestion(question, $index,false)"  ng-show="(question.isShow==-1)" class="am-btn am-btn-default am-btn-xs am-text-danger"><span class="am-icon-trash-o"></span> 取消屏蔽</button>
                                <button ng-click="setTopShow(question,true)"  ng-hide="(question.topBeginDate)" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 置顶</button>
                                <button ng-click="setTop(false,question)"  ng-show="(question.topBeginDate)" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 取消置顶</button>
                                <button ng-click="updateLevel(question, true)"  ng-hide="question.level==1" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 设置精华帖</button>
                                <button ng-click="updateLevel(question, false)" ng-show="question.level==1" class="am-btn am-btn-default am-btn-xs am-text-danger"><span class="am-icon-pencil-square-o"></span> 取消精华帖</button>
                                <button ng-click="updateAcrossCity(question, true)"  ng-hide="question.acrossCity==1" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 设置同城不可见</button>
                                <button ng-click="updateAcrossCity(question, false)" ng-show="question.acrossCity==1" class="am-btn am-btn-default am-btn-xs am-text-danger"><span class="am-icon-pencil-square-o"></span> 取消同城不可见</button>
                                <button class="am-btn am-btn-default am-btn-xs am-text-secondary" ng-click="questionPushShow(question)"><span class="am-icon-copy"></span> 推送</button>

                                <!--删除-->
                                <div class="am-modal am-modal-confirm" tabindex="-1" id="delete-confirm-{{$index}}">
                                    <div class="am-modal-dialog">
                                        <div class="am-modal-hd">{{question.community.communityName}}</div>
                                        <div class="am-modal-bd">
                                            确定要删除这条帖子吗？
                                        </div>
                                        <div class="am-modal-footer">
                                            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                                            <span ng-click="deleteQuestion(question, $index)" class="am-modal-btn" data-am-modal-confirm>确定</span>
                                        </div>
                                    </div>
                                </div>

                                <!--编辑-->
                                <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-Detail-{{$index}}">
                                    <div class="am-modal-dialog">
                                        <div class="am-modal-hd border-bottom" style = "text-align: left;">帖子详细信息
                                            <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
                                        </div>
                                        <div class="am-modal-bd body-area">
                                            <div style = "width:80%" class = "text-left">
                                                <form class="am-form-inline">


                                                    <label>小区名称:</label><input disabled="true" ng-model="question.community.communityName" type="text" class = "modal-input" style = "width: 200px;display: inline-block;"><br>

                                                    <div><label>帖子类型：</label>
                                                        <select data-am-selected="{btnSize: 'sm'}" ng-model="question.category" style = "margin-left:-3px; width: 200px;display: inline-block;">
                                                            <option value='question'>邻里问问</option>
                                                            <option value='share'>随便说说</option>
                                                            <!--<option value='question'>66精选</option>-->
                                                        </select></div>


                                                    <div class="form-group">

                                                        <slide ng-repeat="img in question.images"
                                                               active="img.active">
                                                            <img ng-src="{{img.imageURL}}" style="width: 100px;" onclick="if($(this).width()==100) {
                                                                    $('img').width(100);
                                                                    $(this).width(360);
                                                                    }else{
                                                                        $(this).width(100);
                                                                    };">
                                                        </slide>
                                                    </div>

                                                    <div class="form-group"><label >问题描述:</label><textarea rows="3" cols="20" style="width:600px; height:146px;" class="form-control" ng-model="question.desc" required tabindex="5"></textarea></div>

                                                    <br>

                                                </form>
                                            </div>

                                        </div>
                                        <div class = "button-area border-top">
                                            <button type="button" class="am-btn am-btn-success right-margin top-margin" ng-show="true" ng-click="updateQuestion(question, $index)">保存</button>
                                        </div>
                                    </div>
                                </div>

                                <!--屏蔽-->
                                <div class="am-modal am-modal-confirm" tabindex="-1" id="shield-confirm-{{$index}}">
                                    <div class="am-modal-dialog">
                                        <div class="am-modal-hd">{{question.community.communityName}}</div>
                                        <div class="am-modal-bd">
                                            确定要屏蔽这条帖子吗？
                                        </div>
                                        <div class="am-modal-footer">
                                            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                                            <span ng-click="shieldQuestion(question, $index,true)" class="am-modal-btn" data-am-modal-confirm>确定</span>
                                        </div>
                                    </div>
                                </div>
                                <!--推送消息-->
                                <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-push">
                                    <div class="am-modal-dialog">
                                        <div class="am-modal-hd border-bottom" style = "text-align: left;">帖子推送
                                            <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
                                        </div>
                                        <br>
                                        <div class="am-modal-bd body-area text-left">
                                            <form>
                                                <label>推送内容：</label>
                                                <textarea style="width:580px;height:150px;" ng-model="pushMsg" required tabindex="5"></textarea>
                                            </form>
                                        </div>
                                        <div class = "button-area border-top">
                                            <button type="button"  class="am-btn am-btn-success right-margin top-margin" ng-show="true" ng-click="questionPush(pushMsg)" data-target = "cascad-search-add">确认</button>
                                        </div>

                                    </div>
                                </div>


                            </div>
                         </div>

                    </td>

                </tr>
                </tbody>
            </table>
        </form>
    </div>

    <!--<div class = "left-margin">共<span id = 'page_number'>{{pageNumber}}</span>页 <span>{{count}}条数据</span></div>-->

    <!--置顶-->
    <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-top">
        <div class="am-modal-dialog">
            <div class="am-modal-hd border-bottom" style = "text-align: left;">设置置顶起始时间
                <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
            </div>
            <br>
            <div class="am-modal-bd body-area text-left">
                <form>
                    <label class="left-margin">置顶时间:</label>
                    <input type="text" id="beginDate_top" class="modal-input" size="16" data-date-format="yyyy-mm-dd hh:ii">
                    <label class="left-margin">至：</label>
                    <input type="text" id="endDate_top" class="modal-input" size="16" data-date-format="yyyy-mm-dd hh:ii">
                    <!--宝宝树66小区二次改造    add   chenf  20170731   start-->
                    <br>
                    <input type="radio" name="village" ng-model="topFlg" value="1" ng-checked="1"style="margin-left: 20px;">全国
                    <input type="radio" name="village" ng-model="topFlg" value="2">本小区
                    <!--宝宝树66小区二次改造    add   chenf  20170731   end-->
                </form>
            </div>
            <div class = "button-area border-top">
                <button type="button" class="am-btn am-btn-success right-margin top-margin" ng-show="true" ng-click="setTop(true)" data-target = "cascad-search-add">确认</button>
            </div>

        </div>
    </div>



</div>



<script>$(function ()
{ $("[data-toggle='popover']").popover();
});
</script>

<script>
    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        }
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
                (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o) if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                            ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    }

    var fromDate = $('#startDate').datetimepicker().on('changeDate', function (ev) {
        //alert(ev.date.format('yyyy-MM-dd'));
        //$scope.startDate=ev.date.format('yyyy-MM-dd');
        $("#startDate").val(ev.date.format('yyyy-MM-dd hh:ii'));
//        alert(ev.date);
    });

    var toDate = $('#endDate').datetimepicker().on('changeDate', function (ev) {
        // alert(ev.date.format('yyyy-MM-dd'));
        //$scope.endDate=ev.date.format('yyyy-MM-dd');
        $("#endDate").val(ev.date.format('yyyy-MM-dd hh:ii'));
    });

    var fromDate_top = $('#beginDate_top').datetimepicker().on('changeDate', function (ev) {

        $('#beginDate_top').datetimepicker({
            format: 'yyyy-mm-dd hh:ii'
        });

    });

    var toDate_top = $('#endDate_top').datetimepicker().on('changeDate', function (ev) {
        $('#endDate_top').datetimepicker({
            format: 'yyyy-mm-dd hh:ii'
        });
    });

    var hideContent = function(obj){
        $("#display_hide_content").css("display","block");
        $("#display_hide_content1").text(obj.innerText);
        $("#display_hide_content")[0].style.left = obj.offsetLeft + "px";
        $("#display_hide_content")[0].style.top = 60 + obj.offsetTop + "px";
    };

    $("#display_hide_close").on("click",function(){
        $("#display_hide_content").css("display","none");
    });

</script>